package ee.karileet.ui.catalogue.ui;


import java.util.ResourceBundle;

import com.vaadin.addon.touchkit.extensions.TouchKitIcon;
import com.vaadin.addon.touchkit.ui.NavigationManager;
import com.vaadin.addon.touchkit.ui.TabBarView;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.UI;

import ee.karileet.ui.catalogue.util.Const;
import ee.karileet.ui.catalogue.util.Translations;
import ee.karileet.ui.catalogue.view.GroupListView;
import ee.karileet.ui.catalogue.view.ManufactorListView;

/**
 * The UI's "main" class
 */
@SuppressWarnings("serial")
@Widgetset("ee.karileet.ui.catalogue.gwt.AppWidgetSet")
@Theme("touchkit")
public class MyTouchKitUI extends UI {
    @Override
    protected void init(VaadinRequest request) {
    	ResourceBundle rb = Translations.get(null, Const.TRANSLATIONS);
        final TabBarView tabBarView = new TabBarView();
        final NavigationManager groupListNav = new NavigationManager();
        groupListNav.setCaption(rb.getString("categorys"));
        groupListNav.setCurrentComponent(new GroupListView());
        Tab tab; 
        tab = tabBarView.addTab(groupListNav);
        TouchKitIcon.group.addTo(tab);
        final NavigationManager manufactorListNav = new NavigationManager();
        manufactorListNav.setCaption(rb.getString("manufactors"));
        manufactorListNav.setCurrentComponent(new ManufactorListView());
        tab = tabBarView.addTab(manufactorListNav);
        TouchKitIcon.hdd.addTo(tab);
        setContent(tabBarView);
    }
}
